package com.kgc.scd.controller;

import com.kgc.scd.bean.HotKey;
import com.kgc.scd.service.HotKeyService;
import com.kgc.scd.util.RedisUtils;
import com.kgc.scd.util.RequestResult;
import com.kgc.scd.util.ResultBuildUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * Created On : 2022/6/17.
 * <p>
 * Author     : hi
 * <p>
 * Description: HotKeyController
 */
@Slf4j
@RestController
@Api(tags = "07、热词展示入口")
public class HotKeyController {

    @Autowired
    private HotKeyService hotKeyService;


    /**
     * @param :
     * @return :
     * @author : hi
     * @date : 2022/6/17
     * @description : 添加热词
     */

    @PostMapping("/addHotKeys")
    @ApiOperation(value = "添加热词")
    public RequestResult<HotKey> addHotKey (@RequestParam String hotkeyValue){
        return hotKeyService.addHotKey(hotkeyValue);
    }
    /**
     * @author : hi
     * @date   : 2022/6/14
     * @param  : [java.lang.String]
     * @return : com.kgc.scd.util.RequestResult<com.kgc.scd.bean.HotKey>
     * @description :删除热词
     */

    @PostMapping("/delHotKeys")
    @ApiOperation(value = "删除热词")
    public RequestResult<HotKey> delHotKey (@RequestParam String hotkeyValue){
        return hotKeyService.delHotKey(hotkeyValue);
    }

    /**
     * @author : hi
     * @date   : 2022/6/14
     * @param  : [java.lang.String]
     * @return : com.kgc.scd.util.RequestResult<com.kgc.scd.bean.HotKey>
     * @description :热词展示
     */
    @PostMapping("/HotKeyLists")
    @ApiOperation(value = "全部热词展示")
    RequestResult<List<HotKey>> HotKeyList (){
        return  hotKeyService.HotKeyList("hotkey");
    }

    @PostMapping("/tenHotKeys")
    @ApiOperation(value = "展示最热的热词")
    RequestResult<Object> tenHotKey() {
        RequestResult<Object> objectRequestResult = hotKeyService.tenHotKey();
        System.out.println(objectRequestResult);
        return objectRequestResult;
    }
}
